#pragma once

#include "ObjectCamera.hpp"
#include "ProgramMain.hpp"
#include "VariableEditor.hpp"
#include "VertexDecl.hpp"

class AttractorFractalScreen : public IScreen, public ITwCallbackListener
{
public:
	AttractorFractalScreen();
	virtual ~AttractorFractalScreen();
	
	virtual void Init();
	virtual void Update();
	virtual void Render2d() { }
	virtual void Render3d();
	virtual bool OnKeyDown(uint4 Key) { return false; }
	virtual bool OnKeyUp(uint4 Key) { return false; }
	virtual bool OnChar(char Ch) { return false; }
	virtual bool OnMouseMove(const common::VEC2 &Pos);
	virtual bool OnMouseButton(const common::VEC2 &Pos, frame::MOUSE_BUTTON Button, frame::MOUSE_ACTION Action);
	virtual bool OnMouseWheel(const common::VEC2 &Pos, float Delta);

	virtual void TwSetVar(uint tag, const void *data) { }
	virtual void TwGetVar(uint tag, void *outData) { }
	virtual void TwButton(uint tag);

	//void DescClick();
	//void ResetView();

private:
	TwCallbackContext m_TwccFractalGenerate;
	//common::scoped_ptr<AttractorFractalDesc> m_FractalDesc;
	common::scoped_ptr<VariableEditor> m_FractalDescEditor;
	ObjectCamera3d m_Camera;
	common::scoped_ptr<IDirect3DVertexBuffer9, common::ReleasePolicy> m_Vb;
	common::scoped_ptr<IDirect3DIndexBuffer9, common::ReleasePolicy> m_Ib;
	uint m_VertexCount, m_LineCount;
	VertexDecl m_VertexDecl;
};
